package main

import "fmt"

type TreeNode struct {
	data  int
	left  *TreeNode
	right *TreeNode
}

func Traversal(tree *TreeNode) {
	if tree == nil {
		return
	}

	Traversal(tree.left)
	fmt.Println(tree.data)
	Traversal(tree.right)
}

func main() {
	tn := &TreeNode{
		data: 1,
	}
	tn1 := &TreeNode{
		data: 2,
	}
	tn2 := &TreeNode{
		data: 3,
	}
	tn3 := &TreeNode{
		data: 4,
	}
	tn4 := &TreeNode{
		data: 5,
	}
	tn.left = tn1
	tn.right = tn2
	tn1.left = tn3
	tn1.right = tn4
	Traversal(tn)
}
